package com.wq.myspring.factory;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @PackageName: com.wq.myspring.factorytest
 * @ClassName Mytest
 * @Description: TODO 测试
 * @Author Wenqiang
 * @Date 2021/07/17 5:09
 * @Version V1.0
 */
public class Mytest {
	public static void main(String[] args) {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");

		Foo foo01 = context.getBean("foo1", Foo.class);
		Foo foo02 = context.getBean("foo1", Foo.class);
		System.out.println(foo01);
		System.out.println(foo02);
		System.out.println("------------------------------");

		Foo foo03 = context.getBean("foo2", Foo.class);
		Foo foo04 = context.getBean("foo2", Foo.class);
		System.out.println(foo03);
		System.out.println(foo04);
		System.out.println("------------------------------");

		Foo foo05 = context.getBean("foo3", Foo.class);
		Foo foo06 = context.getBean("foo3", Foo.class);
		System.out.println(foo05);
		System.out.println(foo06);
		System.out.println("------------------------------");

		Foo bean1 = context.getBean("fooFactoryBean", Foo.class);
		FooFactoryBean bean2 = context.getBean("&fooFactoryBean", FooFactoryBean.class);
		System.out.println(bean1);
		System.out.println(bean2);


	}
}
